<!-- vip收入汇总 -->
<template>
<div class="common-body-wrapper">
  <search-header single-width="130" :searchList="searchList" :isCheckbox="true" :isNeedTree="true" @changeHeight="toRetTable" @confirmSearch="toSearch" @handleChange="handleSearchChange" @setSelectedNode="setSelectedNode" :paramName="paramName"></search-header>
  <multi-fun-table :sortColumn='notFormatColumn' :orderType='sortType' :fixed-cols="fixedCols" :is-reset-table="isResetTable" :theads-info="theadsInfo" :tbodys-info="tbodysInfo" @handleMultiCheck="handleMultiCheck" @handleSortColumn="handleSortColumn" @searchFn="getList" @getNextPage="getNextPage">
    <div class="operate-btn-group" slot="operateBtnGroup">
      <a class="ake_btn ake_btn_text" v-if="isPermmited('PARKVIP:DAILY_REPORT:EXPORT')" @click.prevent="exportData()">导出</a>
      <a class="ake_btn ake_btn_text" v-if="isPermmited('PARKVIP:DAILY_REPORT:RECREATE')" @click.prevent="reBuild()">重新生成</a>
    </div>
    <template slot="tdCell" slot-scope="props">
      <el-table-column v-if="props.isMultiHeader" :label="props.label" align="center">
        <template v-for="(item, index) in props.children">
          <el-table-column v-if="item.checked" :key="index" :label="item.text" min-width="50" :prop="item.prop" :sortable="item.sortable">
            <template slot-scope="scope">
              {{ scope.row[item.prop] |formatMoney }}
            </template>
          </el-table-column>
        </template>
      </el-table-column>
      <el-table-column v-else :fixed="props.fixed" :label="props.label" :min-width="props.minWidth" :width="props.width" :prop="props.prop" :sortable="props.sortable">
        <template slot-scope="scope">
          <span v-if="'reno' == props.prop&&scope.$index!==0">{{ scope.$index }}</span>
          <span v-else-if="'reno' == props.prop&&scope.$index==0">合计</span>
          <span v-else-if="'refundOfflineValue' == props.prop">{{ scope.row[props.prop] |formatMoney}}</span>
          <span v-else-if="'handingValue' == props.prop">{{ scope.row[props.prop] |formatMoney}}</span>
          <span v-else>{{ scope.row[props.prop] }}</span>
        </template>
      </el-table-column>
    </template>

    <!--操作列内的按钮-->
    <template slot="operateCell" slot-scope="props">
      <el-table-column :fixed="props.fixed" :label="props.label" width="80">
        <template slot-scope="scope">
          <!-- <el-button v-if="isPermmited('PARKVIP:DAILY_REPORT:RECREATE')" :disabled="scope.$index==0" size="small" type="primary" icon="icon-rebuild" title="重新生成" class="ake-icon-font ake_btn_text" @click="toRecreate(scope.row)" plain></el-button> -->
          <el-button v-if="isPermmited('PARKVIP:DAILY_REPORT:EXPORT_DETAIL')" :disabled="scope.$index==0" size="small" type="primary" icon="icon-export" title="导出详情" class="ake_btn_text ake-icon-font" @click="toExportDetail(scope.row)" plain></el-button>
        </template>
      </el-table-column>
    </template>
  </multi-fun-table>

  <table-pagination :size="total" :cur-page="pageNumber" @backData="getPagination"></table-pagination>

  <ReBuildBtn ref="myReBuildBtn" :reqUrl="reqUrl" :timeDimensionList="timeDimensionList"></ReBuildBtn>
</div>
</template>

<script>
import common from '@mixins/common.js'
import stardardList from '@mixins/tables/stardardList.js'

//modal
import invokeModal from '@mixins/modal/invokeModal.js'
import BigPicModal from '@components/widgets/BigPicModal.vue'

// image
import images from '@mixins/image.js'

// 引进vue的js
import js from './js/daily_report.js'
import ReBuildBtn from "@components/reBuildBtn/index.vue";
export default {
  name: 'parkVipDailyReport',
  mixins: [common, stardardList, invokeModal, images, js],
  components: {
    BigPicModal,
    ReBuildBtn
  },
  data() {
    var today = [new Date(moment().subtract('days', 1).format("YYYY-MM-DD 00:00:00")), new Date(moment().subtract('days', 1).format("YYYY-MM-DD 23:59:59"))]; //昨天
    return {
      paramName:'parkIds',
      reqUrl: '/monthTicket/report/reCountReport.do',
      timeDimensionList: [{
          name: "日报",
          value: "date"
        },
        {
          name: "月报",
          value: "month"
        },
        {
          name: "年报",
          value: "year"
        },
      ],
      fixedCols: 4,
      total: 0,
      searchList: [
        {
          index: 0,
          type: 'select',
          isShow: false,
          name: 'reportDimension',
          text: '时间维度',
          value: 'day',
          isHandleChange: true,
          options: [{
              name: '日报',
              value: 'day'
            },
            {
              name: '月报',
              value: 'month'
            },
            {
              name: '年报',
              value: 'year'
            },
            {
              name: '自定义',
              value: 'custom'
            }
          ]
        },
        {
          index: 1,
          format: "yyyy-MM-dd",
          type: 'datePicker',
          pickerType: "daterange",
          isShow: false,
          name: 'dateFromTo',
          text: '时间区间',
          propName: 'statDateFromStr,statDateToStr',
          value: today,
          style: {
            width: '360px'
          }
        },
        //   {
        //   index: 2,
        //   isShow: false,
        //   initShow: sessionStorage.getItem("isShowOperator") == "false" ? false : true,
        //   type: "text",
        //   name: "query_operatorName",
        //   text: "运营商名称",
        //   value: ""
        //   }

      ],
      theadsInfo: [{
          index: 0,
          isShow: false,
          prop: 'reno',
          text: '序号',
          initHidden: true
        },
        {
          index: 1,
          isShow: false,
          prop: 'statDateDisplay',
          text: '日期',
          minWidth: 70
        },
        {
          index: 2,
          isShow: false,
          prop: 'parkName',
          text: '停车场',
          minWidth: 85
        },
        {
          index: 3,
          isShow: false,
          text: '原总金额',
          isMultiHeader: true,
          children: [{
              index: 0,
              isShow: false,
              prop: 'totalValue',
              text: '总金额',
            },
            {
              index: 1,
              isShow: false,
              prop: 'totalOnlineValue',
              text: '线上金额',
            },
            {
              index: 2,
              isShow: false,
              prop: 'totalOfflineValue',
              text: '线下金额',
            }
          ]
        },
        {
          index: 4,
          isShow: false,
          text: '优惠总金额',
          isMultiHeader: true,
          children: [{
              index: 0,
              isShow: false,
              prop: 'reliefValue',
              text: '总金额',
            },
            {
              index: 1,
              isShow: false,
              prop: 'reliefOnlineValue',
              text: '线上金额',
            },
            {
              index: 2,
              isShow: false,
              prop: 'reliefOfflineValue',
              text: '线下金额',
            }
          ]
        },
        {
          index: 5,
          isShow: false,
          text: '折后总金额',
          isMultiHeader: true,
          children: [{
              index: 0,
              isShow: false,
              prop: 'realValue',
              text: '总金额',
            },
            {
              index: 1,
              isShow: false,
              prop: 'realOnlineValue',
              text: '线上金额',
            },
            {
              index: 2,
              isShow: false,
              prop: 'realOfflineValue',
              text: '线下金额',
            }
          ]
        },
        {
          index: 6,
          isShow: false,
          prop: 'refundOfflineValue',
          text: '线下退款总金额',
          minWidth: 60
        },
        // { index: 7, isShow: false, prop: 'handingValue', text: '线上总手续费',minWidth:60},
        {
          index: 7,
          isShow: false,
          text: '应收总金额',
          isMultiHeader: true,
          children: [{
              index: 0,
              isShow: false,
              prop: 'shouldValue',
              text: '总金额',
            },
            {
              index: 1,
              isShow: false,
              prop: 'shouldOnlineValue',
              text: '线上金额',
            },
            {
              index: 2,
              isShow: false,
              prop: 'shouldOfflineValue',
              text: '线下金额',
            }
          ]
        },
        {
          index: 8,
          isShow: false,
          prop: 'updateBy',
          text: '最近操作人',
          minWidth: 90
        },
        {
          index: 9,
          isShow: false,
          prop: 'updateTime',
          text: '最近操作时间',
          width: 90,
          minWidth: 90
        }
      ],
      tbodysInfo: []
    }
  },
  methods: {
    // confirmSearch(params) {
    //     this.getList();
    // }
  }
}
</script>

<style lang="less" scoped>
.ModalBody {
  padding: 20px 35px;

  .HeadMSG {
    display: flex;
    margin-bottom: 10px;

    li:first-child {
      margin-right: 20px;
    }
  }
}
</style>
